﻿using System;
using System.Web;
using System.Web.Mvc;
using System.Collections.Generic;
using JqueryMvc;
using MvcContrib.Attributes;
using MvcContrib;
using System.Collections;

namespace jquerymvc.Controllers
{
    [Rescue("security", typeof(System.Security.SecurityException))]
    public class HomeController : BaseController
    {
        [ControllerAction]
        public void Index(string name)
        {
            ViewData["Messages"] = new List<string>();
            if (name == "Britney")
                throw new Exception("Go away!");
            else if (name == "Luke")
                ((IList)ViewData["Messages"]).Add("May the force be with you!");
            
            if (!string.IsNullOrEmpty(name))
                ViewData["HelloWorld"] = "Hi " + name + "!";

            RenderView("Index");
        }

        [ControllerAction]
        public void About()
        {
            RenderView("About");
        }

    }
}
